{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: tqdm in d:\\program\\anaconda\\envs\\ai\\lib\\site-packages (4.46.0)\n",
      "Requirement already satisfied: lightgbm in d:\\program\\anaconda\\envs\\ai\\lib\\site-packages (2.3.0)\n",
      "Requirement already satisfied: numpy in d:\\program\\anaconda\\envs\\ai\\lib\\site-packages (from lightgbm) (1.17.4)\n",
      "Requirement already satisfied: scipy in d:\\program\\anaconda\\envs\\ai\\lib\\site-packages (from lightgbm) (1.3.2)\n",
      "Requirement already satisfied: scikit-learn in d:\\program\\anaconda\\envs\\ai\\lib\\site-packages (from lightgbm) (0.22.1)\n",
      "Requirement already satisfied: joblib>=0.11 in d:\\program\\anaconda\\envs\\ai\\lib\\site-packages (from scikit-learn->lightgbm) (0.14.1)\n"
     ]
    }
   ],
   "source": [
    "! pip install tqdm\n",
    "! pip install lightgbm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from tqdm import tqdm\n",
    "from sklearn.metrics import mean_squared_error,explained_variance_score\n",
    "from sklearn.model_selection import KFold\n",
    "import lightgbm as lgb\n",
    "import math\n",
    "import os\n",
    "from joblib import Parallel, delayed\n",
    "\n",
    "test_data_path = '../data/testData0626_correction.csv'\n",
    "route_order_folder_path = '../data/route_order_data'\n",
    "port_path = '../data/port.csv'\n",
    "result_path = '../result_server_20200629_B_origin.csv'\n",
    "\n",
    "# import moxing as mox\n",
    "# OBS_RES_PATH =  \"s3://ship-eta/result/result_server_20200622.csv\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def format_data_type(data, mode='train'):\n",
    "    if mode=='test':\n",
    "        data['onboardDate'] = pd.to_datetime(data['onboardDate'], infer_datetime_format=True)\n",
    "        data['temp_timestamp'] = data['timestamp']\n",
    "        data['ETA'] = None\n",
    "        data['creatDate'] = None\n",
    "    data['loadingOrder'] = data['loadingOrder'].astype(str)\n",
    "    data['timestamp'] = pd.to_datetime(data['timestamp'], infer_datetime_format=True)\n",
    "    data['longitude'] = data['longitude'].astype(float)\n",
    "    data['latitude'] = data['latitude'].astype(float)\n",
    "    data['speed'] = data['speed'].astype(float)\n",
    "    data['TRANSPORT_TRACE'] = data['TRANSPORT_TRACE'].astype(str)\n",
    "    return data\n",
    "\n",
    "def get_test_data_info(path):\n",
    "    data = pd.read_csv(path) \n",
    "    test_trace_set = data['TRANSPORT_TRACE'].unique()\n",
    "    test_order_belong_to_trace = {}\n",
    "    for item in test_trace_set:\n",
    "        orders = data[data['TRANSPORT_TRACE'] == item]['loadingOrder'].unique()\n",
    "        test_order_belong_to_trace[item] = orders\n",
    "    return format_data_type(data, mode='test'), test_trace_set, test_order_belong_to_trace\n",
    "\n",
    "test_data_origin, test_trace_set, test_order_belong_to_trace = get_test_data_info(test_data_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_port_info():\n",
    "    port_data = {}\n",
    "    test_port_set = set()\n",
    "    for route in test_trace_set:\n",
    "        ports = route.split('-')\n",
    "        test_port_set = set.union(test_port_set, set(ports))\n",
    "    port_data_origin = pd.read_csv(port_path)\n",
    "    for item in port_data_origin.itertuples():\n",
    "        if getattr(item, 'TRANS_NODE_NAME') in test_port_set:\n",
    "            port_data[getattr(item, 'TRANS_NODE_NAME')] = {'LONGITUDE': getattr(item, 'LONGITUDE'),'LATITUDE': getattr(item, 'LATITUDE') }\n",
    "    return port_data\n",
    "port_data = get_port_info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_train_route_order_data(route):\n",
    "    route_order_data_path = os.path.join(route_order_folder_path, \"{}.csv\".format(route))\n",
    "    data_origin = pd.read_csv(route_order_data_path, header=None, usecols = [0,2,3,4]\n",
    "           , names=['loadingOrder','longitude','latitude','speed'])\n",
    "    if (data_origin.shape[0] == 0):\n",
    "        print(\"error == \", route)\n",
    "    route_order_data_path = os.path.join(route_order_folder_path, \"{}_speed_dis_time.csv\".format(route))\n",
    "    route_order_handled = pd.read_csv(route_order_data_path, usecols = [1,2,3,4])\n",
    "    return data_origin, route_order_handled"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "agg_dict = {'latitude':['median'], 'longitude':['median'], 'speed':['max']}\n",
    "cols = ['{}_{}'.format(k1, k2) for k1 in agg_dict for k2 in agg_dict[k1]]\n",
    "\n",
    "def handle_train_data(name, order_info_set, route_order_handled):\n",
    "    order_info_set = order_info_set.reset_index(drop=True)\n",
    "#         人工截取前 40% 的数据   \n",
    "#     order_info_set = order_info_set[start_index:end_index+1]\n",
    "#     cut_size = math.ceil(order_info_set.shape[0]*0.4)\n",
    "#     order_info_set = order_info_set[0:cut_size]\n",
    "#         截取数据\n",
    "    if (order_info_set.shape[0] > 100):\n",
    "        index = np.linspace(0, order_info_set.shape[0]-1, num=100,dtype=int).tolist()\n",
    "        order_info_set = order_info_set.iloc[index]     \n",
    "#         获取经纬度速度信息\n",
    "    feature_temp = order_info_set.groupby('loadingOrder').agg(agg_dict).reset_index()\n",
    "    feature_temp.columns = ['loadingOrder'] + cols\n",
    "    label = route_order_handled[route_order_handled['loadingOrder'] == name].label\n",
    "#     feature_temp['label'] = (route_order_handled[route_order_handled['loadingOrder'] == name].label)\n",
    "    feature_temp['label'] = float(label)\n",
    "#     print(label, feature_temp)\n",
    "    return feature_temp   \n",
    "\n",
    "def get_train_data(route_order_info, route_order_handled):\n",
    "    order_list = route_order_info['loadingOrder'].unique()\n",
    "    print(route, order_list.shape)\n",
    "    \n",
    "    data_grouped = route_order_info.groupby('loadingOrder')\n",
    "\n",
    "    train_data = Parallel(n_jobs=8)(delayed(handle_train_data)(name, group, route_order_handled) for name, group in data_grouped)\n",
    "    train_data = pd.concat(train_data)\n",
    "#     for name, group in data_grouped:\n",
    "#         handle_train_data(name, group, route_order_handled)\n",
    "    if (train_data.shape[0] < 10):\n",
    "        for i in range(5):\n",
    "            train_data = pd.concat([train_data,train_data])\n",
    "    return train_data.reset_index(drop=True)\n",
    "\n",
    "def get_test_data(order):\n",
    "    order_info_set = test_data_origin[test_data_origin['loadingOrder'] == order].sort_values(by='timestamp')\n",
    "\n",
    "    feature = order_info_set.groupby('loadingOrder').agg(agg_dict).reset_index()\n",
    "    feature.columns = ['loadingOrder'] + cols\n",
    "    return feature.reset_index(drop=True)\n",
    "def mse_score_eval(preds, valid):\n",
    "    labels = valid.get_label()\n",
    "    scores = mean_squared_error(y_true=labels, y_pred=preds)\n",
    "    return 'mse_score', scores, True\n",
    "def train_model(x, y, seed=981125, is_shuffle=True):\n",
    "    train_pred = np.zeros((x.shape[0], ))\n",
    "    n_splits = min(5, x.shape[0])\n",
    "    # Kfold\n",
    "    fold = KFold(n_splits=n_splits, shuffle=is_shuffle, random_state=seed)\n",
    "    kf_way = fold.split(x)\n",
    "    # params\n",
    "    params = {\n",
    "        'learning_rate': 0.01,\n",
    "        'boosting_type': 'gbdt',\n",
    "        'objective': 'regression',\n",
    "        'num_leaves': 36,\n",
    "        'feature_fraction': 0.6,\n",
    "        'bagging_fraction': 0.7,\n",
    "        'bagging_freq': 6,\n",
    "        'seed': 8,\n",
    "        'bagging_seed': 1,\n",
    "        'feature_fraction_seed': 7,\n",
    "        'min_data_in_leaf': 25,\n",
    "        'nthread': 8,\n",
    "        'verbose': 1,\n",
    "    }\n",
    "    # train\n",
    "    for n_fold, (train_idx, valid_idx) in enumerate(kf_way, start=1):\n",
    "        train_x, train_y = x.iloc[train_idx], y.iloc[train_idx]\n",
    "        valid_x, valid_y = x.iloc[valid_idx], y.iloc[valid_idx]\n",
    "        # 数据加载\n",
    "        n_train = lgb.Dataset(train_x, label=train_y)\n",
    "        n_valid = lgb.Dataset(valid_x, label=valid_y)\n",
    "        clf = lgb.train(\n",
    "            params=params,\n",
    "            train_set=n_train,\n",
    "            num_boost_round=3000,\n",
    "            valid_sets=[n_valid],\n",
    "            early_stopping_rounds=100,\n",
    "            verbose_eval=100,\n",
    "            feval=mse_score_eval\n",
    "        )\n",
    "        train_pred[valid_idx] = clf.predict(valid_x, num_iteration=clf.best_iteration)\n",
    "    return clf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "tags": [
     "outputPrepend"
    ]
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "  0%|          | 0/21 [00:00<?, ?it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AA191175561416          35.0  1.486761e+07  2167517.0\n",
      "1    AA849985976383          22.0  1.439630e+07  2494699.0\n",
      "2    AH861147242321          28.0  1.445951e+07  2029634.0\n",
      "3    AL979269865349          28.0  1.461749e+07  2063997.0\n",
      "4    AM967786650823          26.0  1.462739e+07  2147925.0\n",
      "..              ...           ...           ...        ...\n",
      "819  ZW587095293016           0.0  1.433048e+07  1903686.0\n",
      "820  ZX198466828718          26.0  1.468295e+07  2024710.0\n",
      "821  ZX476649622217          26.0  1.462831e+07  2147925.0\n",
      "822  ZX741696557865          34.5  1.487163e+07  2061171.0\n",
      "823  ZY989876486292          33.0  1.441676e+07  2157238.0\n",
      "\n",
      "[824 rows x 4 columns]\n",
      "CNYTN-MXZLO (824,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AA191175561416        30.478670        122.079717         45  2167517.0\n",
      "1    AA849985976383        38.303492        119.423100         38  2494699.0\n",
      "2    AH861147242321        25.743527        119.933405         40  2029634.0\n",
      "3    AL979269865349        29.780267        -87.449567         33  2063997.0\n",
      "4    AM967786650823        29.993048        122.482602         37  2147925.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "819  ZW587095293016        27.193894        118.343911         37  1903686.0\n",
      "820  ZX198466828718        29.700581        120.825481         37  2024710.0\n",
      "821  ZX476649622217        29.990792        122.480981         37  2147925.0\n",
      "822  ZX741696557865        30.682355         13.421513         40  2061171.0\n",
      "823  ZY989876486292        41.717600       -122.718544         37  2157238.0\n",
      "\n",
      "[824 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.90471e+10\tvalid_0's mse_score: 5.90471e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 6.64623e+10\tvalid_0's mse_score: 6.64623e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.31397e+10\tvalid_0's mse_score: 3.31397e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.55234e+10\tvalid_0's mse_score: 3.55234e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.89952e+10\tvalid_0's mse_score: 5.89952e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 6.48149e+10\tvalid_0's mse_score: 6.48149e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.02936e+10\tvalid_0's mse_score: 3.02936e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.35648e+10\tvalid_0's mse_score: 3.35648e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.0309e+10\tvalid_0's mse_score: 5.0309e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 5.45429e+10\tvalid_0's mse_score: 5.45429e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "  5%|▍         | 1/21 [00:48<16:19, 48.98s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "        loadingOrder  speed_median     total_dis     label\n",
      "0     AA236935066990          24.0  2.685929e+06  374428.0\n",
      "1     AA597788695392          33.0  2.691566e+06  288172.0\n",
      "2     AA642567891255          23.0  2.684912e+06  326548.0\n",
      "3     AA681773043065          29.0  2.720285e+06  321478.0\n",
      "4     AB283635056094          30.5  2.713435e+06  309252.0\n",
      "...              ...           ...           ...       ...\n",
      "7572  ZZ936085205111          27.0  2.700691e+06  329922.0\n",
      "7573  ZZ958783621355          29.0  2.671521e+06  290940.0\n",
      "7574  ZZ964257538884          18.0  2.713565e+06  434727.0\n",
      "7575  ZZ968915097734          22.0  2.645090e+06  326628.0\n",
      "7576  ZZ992682575994          30.0  2.711504e+06  301117.0\n",
      "\n",
      "[7577 rows x 4 columns]\n",
      "CNSHK-MYTPP (7577,)\n",
      "        loadingOrder  latitude_median  longitude_median  speed_max     label\n",
      "0     AA236935066990        36.130617          7.623525         38  374428.0\n",
      "1     AA597788695392         3.443752        101.261245         36  288172.0\n",
      "2     AA642567891255         3.357050        101.956049         34  326548.0\n",
      "3     AA681773043065         2.590733        104.161091         32  321478.0\n",
      "4     AB283635056094        19.641250        112.848083         33  309252.0\n",
      "...              ...              ...               ...        ...       ...\n",
      "7572  ZZ936085205111         2.100575        103.926508         31  329922.0\n",
      "7573  ZZ958783621355         5.923407        100.733506         35  290940.0\n",
      "7574  ZZ964257538884       -20.140887         57.491727         35  434727.0\n",
      "7575  ZZ968915097734        19.378290         98.848734         35  326628.0\n",
      "7576  ZZ992682575994         2.644458        102.035500         32  301117.0\n",
      "\n",
      "[7577 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.72196e+10\tvalid_0's mse_score: 1.72196e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.94999e+10\tvalid_0's mse_score: 1.94999e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.72295e+10\tvalid_0's mse_score: 2.72295e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.08745e+10\tvalid_0's mse_score: 3.08745e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.9396e+10\tvalid_0's mse_score: 1.9396e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.20632e+10\tvalid_0's mse_score: 2.20632e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.41808e+10\tvalid_0's mse_score: 1.41808e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.65904e+10\tvalid_0's mse_score: 1.65904e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.11699e+10\tvalid_0's mse_score: 3.11699e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.46471e+10\tvalid_0's mse_score: 3.46471e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 10%|▉         | 2/21 [08:59<57:29, 181.58s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "        loadingOrder  speed_median     total_dis     label\n",
      "0     AA236935066990          24.0  2.668233e+06  371889.0\n",
      "1     AA597788695392          33.0  2.667065e+06  286252.0\n",
      "2     AA642567891255          23.0  2.667188e+06  321759.0\n",
      "3     AA681773043065          29.0  2.697736e+06  318936.0\n",
      "4     AB283635056094          30.5  2.695056e+06  306631.0\n",
      "...              ...           ...           ...       ...\n",
      "7576  ZZ936085205111          27.0  2.682246e+06  326712.0\n",
      "7577  ZZ958783621355          31.0  2.652040e+06  285551.0\n",
      "7578  ZZ964257538884          18.0  2.696090e+06  430896.0\n",
      "7579  ZZ968915097734          23.0  2.626224e+06  322247.0\n",
      "7580  ZZ992682575994          30.0  2.689988e+06  298753.0\n",
      "\n",
      "[7581 rows x 4 columns]\n",
      "CNSHK-SGSIN (7581,)\n",
      "        loadingOrder  latitude_median  longitude_median  speed_max     label\n",
      "0     AA236935066990        36.130617          7.623525         38  371889.0\n",
      "1     AA597788695392         3.443752        101.261245         36  286252.0\n",
      "2     AA642567891255         3.357050        101.956049         34  321759.0\n",
      "3     AA681773043065         2.590733        104.161091         32  318936.0\n",
      "4     AB283635056094        19.641250        112.848083         33  306631.0\n",
      "...              ...              ...               ...        ...       ...\n",
      "7576  ZZ936085205111         2.100575        103.926508         31  326712.0\n",
      "7577  ZZ958783621355         5.923407        100.733506         35  285551.0\n",
      "7578  ZZ964257538884       -20.140887         57.491727         35  430896.0\n",
      "7579  ZZ968915097734        19.378290         98.848734         35  322247.0\n",
      "7580  ZZ992682575994         2.644458        102.035500         32  298753.0\n",
      "\n",
      "[7581 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.64786e+10\tvalid_0's mse_score: 2.64786e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.03007e+10\tvalid_0's mse_score: 3.03007e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.06165e+10\tvalid_0's mse_score: 2.06165e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.33505e+10\tvalid_0's mse_score: 2.33505e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.60978e+10\tvalid_0's mse_score: 2.60978e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.94493e+10\tvalid_0's mse_score: 2.94493e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.56711e+10\tvalid_0's mse_score: 1.56711e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.7951e+10\tvalid_0's mse_score: 1.7951e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.65702e+10\tvalid_0's mse_score: 1.65702e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.92075e+10\tvalid_0's mse_score: 1.92075e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 14%|█▍        | 3/21 [15:59<1:15:54, 253.04s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AD337174254498          36.0  1.748102e+07  1982821.0\n",
      "1    AE414406255230          33.0  1.753927e+07  2110162.0\n",
      "2    AF291281245513          37.0  1.753676e+07  1747886.0\n",
      "3    AG172089289690          35.0  1.701965e+07  1816918.0\n",
      "4    AI695744190230          36.0  1.712188e+07  1757343.0\n",
      "..              ...           ...           ...        ...\n",
      "523  ZU726932267888          35.0  1.743891e+07  1807695.0\n",
      "524  ZV682004760041          36.0  1.701269e+07  1999384.0\n",
      "525  ZY333350082535          35.0  1.717674e+07  2142547.0\n",
      "526  ZY837282165067          35.0  1.722944e+07  1826802.0\n",
      "527  ZY846318851530          32.0  1.729784e+07  2063743.0\n",
      "\n",
      "[528 rows x 4 columns]\n",
      "CNYTN-PAONX (528,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AD337174254498        10.655167        -59.636917         39  1982821.0\n",
      "1    AE414406255230        34.451276        122.024786         39  2110162.0\n",
      "2    AF291281245513        25.474240        -79.499568         43  1747886.0\n",
      "3    AG172089289690        34.627956        115.258519         42  1816918.0\n",
      "4    AI695744190230        30.776874        114.988542         42  1757343.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "523  ZU726932267888        26.770501        -83.991427         41  1807695.0\n",
      "524  ZV682004760041        33.814954        127.532906         41  1999384.0\n",
      "525  ZY333350082535        43.132077       -153.249494         37  2142547.0\n",
      "526  ZY837282165067        30.375068        -79.722331         40  1826802.0\n",
      "527  ZY846318851530        33.834029        -99.509959         37  2063743.0\n",
      "\n",
      "[528 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.61322e+11\tvalid_0's mse_score: 1.61322e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.90226e+11\tvalid_0's mse_score: 1.90226e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.31589e+11\tvalid_0's mse_score: 1.31589e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.56197e+11\tvalid_0's mse_score: 1.56197e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.44709e+11\tvalid_0's mse_score: 1.44709e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.84337e+11\tvalid_0's mse_score: 1.84337e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.13077e+11\tvalid_0's mse_score: 1.13077e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.42984e+11\tvalid_0's mse_score: 1.42984e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.22461e+11\tvalid_0's mse_score: 1.22461e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.61398e+11\tvalid_0's mse_score: 1.61398e+11\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 19%|█▉        | 4/21 [16:50<54:28, 192.24s/it]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "      loadingOrder  speed_median     total_dis      label\n",
      "0   AC118422359182          31.0  1.892202e+07  3699983.0\n",
      "1   AC458999327091          32.0  1.951035e+07  2399120.0\n",
      "2   AP254924452907          32.0  1.982125e+07  2463805.0\n",
      "3   AS953078762857          27.0  2.346280e+07  3576521.0\n",
      "4   BH140084651120          29.0  1.946977e+07  2487256.0\n",
      "..             ...           ...           ...        ...\n",
      "64  YV465701899809          29.0  1.945584e+07  2504119.0\n",
      "65  YW391046018891          32.0  1.950300e+07  2563344.0\n",
      "66  YW638325217174          36.0  2.038401e+07  2367182.0\n",
      "67  ZM381066091094          28.0  1.909797e+07  2352888.0\n",
      "68  ZU416619710839          28.0  1.909797e+07  2352888.0\n",
      "\n",
      "[69 rows x 4 columns]\n",
      "CNSHK-CLVAP (69,)\n",
      "      loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0   AC118422359182       -42.324550       -110.706066         36  3699983.0\n",
      "1   AC458999327091       -37.087485       -124.681520         34  2399120.0\n",
      "2   AP254924452907       -37.594429       -100.360028         38  2463805.0\n",
      "3   AS953078762857        30.297166        122.813897         40  3576521.0\n",
      "4   BH140084651120       -37.635565        113.978956         33  2487256.0\n",
      "..             ...              ...               ...        ...        ...\n",
      "64  YV465701899809        -1.983025        122.143412         35  2504119.0\n",
      "65  YW391046018891       -36.423653       -141.400906         38  2563344.0\n",
      "66  YW638325217174       -17.047248       -108.235540         38  2367182.0\n",
      "67  ZM381066091094       -34.362817        -71.816571         34  2352888.0\n",
      "68  ZU416619710839       -34.362817        -71.816571         34  2352888.0\n",
      "\n",
      "[69 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 8.85585e+12\tvalid_0's mse_score: 8.85585e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 8.85585e+12\tvalid_0's mse_score: 8.85585e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.57405e+12\tvalid_0's mse_score: 5.57405e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 5.57405e+12\tvalid_0's mse_score: 5.57405e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 7.29398e+12\tvalid_0's mse_score: 7.29398e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 7.29398e+12\tvalid_0's mse_score: 7.29398e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 9.66933e+12\tvalid_0's mse_score: 9.66933e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 9.66933e+12\tvalid_0's mse_score: 9.66933e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.5831e+12\tvalid_0's mse_score: 5.5831e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 5.5831e+12\tvalid_0's mse_score: 5.5831e+12\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 24%|██▍       | 5/21 [16:59<36:35, 137.23s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "      loadingOrder  speed_median     total_dis      label\n",
      "0   AQ889642404042          30.0  2.103271e+07  3429164.0\n",
      "1   AU510504184664          24.0  2.053756e+07  3245168.0\n",
      "2   BQ425517215925          26.5  2.144197e+07  2836365.0\n",
      "3   BT552005629187          21.5  2.133688e+07  3897303.0\n",
      "4   BX633511112869          30.0  2.103300e+07  3429164.0\n",
      "..             ...           ...           ...        ...\n",
      "77  YY314907990848          29.0  2.093842e+07  3106090.0\n",
      "78  ZB984347982509          25.0  2.127990e+07  3153223.0\n",
      "79  ZK570930733133          19.0  2.140301e+07  3035161.0\n",
      "80  ZL336113063705          15.0  2.068156e+07  3180989.0\n",
      "81  ZS104404854005          29.5  2.132682e+07  3265432.0\n",
      "\n",
      "[82 rows x 4 columns]\n",
      "CNYTN-ARENA (82,)\n",
      "      loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0   AQ889642404042       -24.520077         17.853480         40  3429164.0\n",
      "1   AU510504184664       -28.561865        -46.321355         39  3245168.0\n",
      "2   BQ425517215925       -24.754601        -14.708111         39  2836365.0\n",
      "3   BT552005629187       -27.944890         12.378376        189  3897303.0\n",
      "4   BX633511112869       -24.520077         17.851773         40  3429164.0\n",
      "..             ...              ...               ...        ...        ...\n",
      "77  YY314907990848       -26.739767         43.448067         39  3106090.0\n",
      "78  ZB984347982509       -25.499967        -43.669225         37  3153223.0\n",
      "79  ZK570930733133       -24.053099         18.070710         39  3035161.0\n",
      "80  ZL336113063705         1.272320        103.904088         33  3180989.0\n",
      "81  ZS104404854005         1.211920        100.921000         35  3265432.0\n",
      "\n",
      "[82 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 9.80012e+12\tvalid_0's mse_score: 9.80012e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 9.80012e+12\tvalid_0's mse_score: 9.80012e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.01517e+13\tvalid_0's mse_score: 1.01517e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.01517e+13\tvalid_0's mse_score: 1.01517e+13\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.0279e+13\tvalid_0's mse_score: 1.0279e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.0279e+13\tvalid_0's mse_score: 1.0279e+13\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.03959e+13\tvalid_0's mse_score: 1.03959e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.03959e+13\tvalid_0's mse_score: 1.03959e+13\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.09589e+13\tvalid_0's mse_score: 1.09589e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.09589e+13\tvalid_0's mse_score: 1.09589e+13\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 29%|██▊       | 6/21 [17:12<25:01, 100.11s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "        loadingOrder  speed_median     total_dis      label\n",
      "0     AA236935066990          31.0  1.559747e+07  2454467.0\n",
      "1     AB232279245750          33.0  1.558396e+07  1711401.0\n",
      "2     AB341124011989          31.0  1.557420e+07  2418080.0\n",
      "3     AB470160617552          23.0  1.531056e+07  1728144.0\n",
      "4     AB638889966402          26.0  1.559353e+07  1682768.0\n",
      "...              ...           ...           ...        ...\n",
      "1912  ZY608485028767          35.0  1.424975e+07  1697265.0\n",
      "1913  ZZ116104459754           0.0  1.568391e+07  1765816.0\n",
      "1914  ZZ145330853506          34.0  1.538930e+07  1831166.0\n",
      "1915  ZZ471173220102          32.5  1.565470e+07  1768336.0\n",
      "1916  ZZ699919644249          35.0  1.424975e+07  1697265.0\n",
      "\n",
      "[1917 rows x 4 columns]\n",
      "CNYTN-MATNG (1917,)\n",
      "        loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0     AA236935066990        36.130617          7.623525         38  2454467.0\n",
      "1     AB232279245750        35.971917         14.891521         42  1711401.0\n",
      "2     AB341124011989        32.726416         28.620650         36  2418080.0\n",
      "3     AB470160617552        49.899233         -1.153241         35  1728144.0\n",
      "4     AB638889966402        31.303753         32.327081         40  1682768.0\n",
      "...              ...              ...               ...        ...        ...\n",
      "1912  ZY608485028767        35.644080         18.373088         42  1697265.0\n",
      "1913  ZZ116104459754        35.092447         19.849456         39  1765816.0\n",
      "1914  ZZ145330853506        36.328858         11.280742         37  1831166.0\n",
      "1915  ZZ471173220102        33.895600         24.164133         38  1768336.0\n",
      "1916  ZZ699919644249        35.644080         18.373088         42  1697265.0\n",
      "\n",
      "[1917 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.99939e+10\tvalid_0's mse_score: 2.99939e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 4.37779e+10\tvalid_0's mse_score: 4.37779e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.15075e+10\tvalid_0's mse_score: 3.15075e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 4.49042e+10\tvalid_0's mse_score: 4.49042e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.43046e+10\tvalid_0's mse_score: 3.43046e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 4.41786e+10\tvalid_0's mse_score: 4.41786e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.62691e+10\tvalid_0's mse_score: 3.62691e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 5.02117e+10\tvalid_0's mse_score: 5.02117e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.75344e+10\tvalid_0's mse_score: 5.75344e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 7.21732e+10\tvalid_0's mse_score: 7.21732e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 33%|███▎      | 7/21 [19:25<25:40, 110.06s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AG781637728507          31.0  1.315032e+07  1635002.0\n",
      "1    AO393647206772          31.0  1.322626e+07  1772744.0\n",
      "2    AS316641737557          29.0  1.318936e+07  1711057.0\n",
      "3    AX514253100826          24.5  1.337384e+07  2284327.0\n",
      "4    AZ675353940464          30.0  1.308141e+07  1638932.0\n",
      "..              ...           ...           ...        ...\n",
      "110  YM295763629909           0.0  1.390017e+07  2004587.0\n",
      "111  YY214900937023          29.0  1.318936e+07  1711057.0\n",
      "112  ZL826451484122          27.5  1.303495e+07  1788581.0\n",
      "113  ZM490479048723          30.0  1.302213e+07  1743255.0\n",
      "114  ZZ580809707648          29.0  1.318785e+07  1711057.0\n",
      "\n",
      "[115 rows x 4 columns]\n",
      "CNSHK-GRPIR (115,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AG781637728507        21.330002         41.062024         34  1635002.0\n",
      "1    AO393647206772        22.287395         40.760166         35  1772744.0\n",
      "2    AS316641737557        29.665306         32.583487         38  1711057.0\n",
      "3    AX514253100826        35.833866         25.966341         40  2284327.0\n",
      "4    AZ675353940464        23.517069         36.964354         38  1638932.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "110  YM295763629909        21.574579        101.064827         33  2004587.0\n",
      "111  YY214900937023        29.665306         32.583487         38  1711057.0\n",
      "112  ZL826451484122        22.429227         43.833376         36  1788581.0\n",
      "113  ZM490479048723        22.217863         99.908646         37  1743255.0\n",
      "114  ZZ580809707648        29.660522         32.584526         37  1711057.0\n",
      "\n",
      "[115 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.01021e+10\tvalid_0's mse_score: 3.01021e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.08384e+10\tvalid_0's mse_score: 3.08384e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 6.16217e+10\tvalid_0's mse_score: 6.16217e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 6.71042e+10\tvalid_0's mse_score: 6.71042e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.76021e+11\tvalid_0's mse_score: 1.76021e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.84155e+11\tvalid_0's mse_score: 1.84155e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 4.45098e+10\tvalid_0's mse_score: 4.45098e+10\n",
      "Early stopping, best iteration is:\n",
      "[12]\tvalid_0's l2: 4.1613e+10\tvalid_0's mse_score: 4.1613e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.26525e+11\tvalid_0's mse_score: 1.26525e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.3896e+11\tvalid_0's mse_score: 1.3896e+11\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 38%|███▊      | 8/21 [19:34<17:14, 79.54s/it] "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AC805998752079          14.5  8.246658e+06  1500319.0\n",
      "1    AE338443959265           4.0  8.275872e+06  1431954.0\n",
      "2    AF269374337927          30.0  8.259018e+06  1299918.0\n",
      "3    AO368338891545          11.0  8.357387e+06  1771231.0\n",
      "4    AR152962358295          23.0  8.189167e+06  1596072.0\n",
      "..              ...           ...           ...        ...\n",
      "310  ZV202516667720          30.0  8.261669e+06  1299556.0\n",
      "311  ZV381634064028           0.0  7.532922e+06  1271676.0\n",
      "312  ZY478921403623          30.0  8.259018e+06  1299918.0\n",
      "313  ZZ786612239899          15.5  8.228440e+06  1319582.0\n",
      "314  ZZ968915097734          13.5  8.163535e+06  1838054.0\n",
      "\n",
      "[315 rows x 4 columns]\n",
      "CNSHK-PKQCT (315,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AC805998752079         2.927750        101.287167         32  1500319.0\n",
      "1    AE338443959265         6.393713         91.469181         36  1431954.0\n",
      "2    AF269374337927         9.357775         76.136267         33  1299918.0\n",
      "3    AO368338891545        22.433558         70.140146         31  1771231.0\n",
      "4    AR152962358295        17.072392         83.887709         34  1596072.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "310  ZV202516667720         9.313116         76.125225         33  1299556.0\n",
      "311  ZV381634064028        22.421840         99.622391         36  1271676.0\n",
      "312  ZY478921403623         9.357775         76.136267         33  1299918.0\n",
      "313  ZZ786612239899         2.766435        101.288041         38  1319582.0\n",
      "314  ZZ968915097734        19.378290         98.848734         35  1838054.0\n",
      "\n",
      "[315 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.0225e+10\tvalid_0's mse_score: 1.0225e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.43995e+10\tvalid_0's mse_score: 1.43995e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.04718e+10\tvalid_0's mse_score: 1.04718e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.55281e+10\tvalid_0's mse_score: 1.55281e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.29205e+10\tvalid_0's mse_score: 1.29205e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.04708e+10\tvalid_0's mse_score: 2.04708e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.27851e+10\tvalid_0's mse_score: 1.27851e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.63724e+10\tvalid_0's mse_score: 1.63724e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.31172e+10\tvalid_0's mse_score: 1.31172e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.86298e+10\tvalid_0's mse_score: 1.86298e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 43%|████▎     | 9/21 [19:45<11:48, 59.07s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AC357556396608          31.0  1.501780e+07  1978450.0\n",
      "1    AC449966542855          27.0  1.516670e+07  1971427.0\n",
      "2    AJ769380659400          31.0  1.510014e+07  1972067.0\n",
      "3    AK317742944760          25.0  1.498058e+07  1915099.0\n",
      "4    AK630924839155          33.5  1.479944e+07  2073879.0\n",
      "..              ...           ...           ...        ...\n",
      "550  ZX573411912521          28.0  9.317671e+06  1939326.0\n",
      "551  ZX952139706480          25.0  1.476917e+07  2083493.0\n",
      "552  ZZ233055353548          25.0  1.499632e+07  1915099.0\n",
      "553  ZZ675551136571          28.0  1.489943e+07  2145560.0\n",
      "554  ZZ676084526882          31.5  1.428513e+07  1637154.0\n",
      "\n",
      "[555 rows x 4 columns]\n",
      "CNSHK-SIKOP (555,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AC357556396608        22.241708         40.718241         37  1978450.0\n",
      "1    AC449966542855        22.354793         43.484816         36  1971427.0\n",
      "2    AJ769380659400        33.860534         23.226316         34  1972067.0\n",
      "3    AK317742944760        29.752500         32.572750         40  1915099.0\n",
      "4    AK630924839155        33.204375         32.461592         38  2073879.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "550  ZX573411912521        22.466301        113.875437         37  1939326.0\n",
      "551  ZX952139706480        20.894660         52.054586         38  2083493.0\n",
      "552  ZZ233055353548        29.752500         32.572748         40  1915099.0\n",
      "553  ZZ675551136571        22.347950         44.605400         36  2145560.0\n",
      "554  ZZ676084526882        30.167599         32.541825         38  1637154.0\n",
      "\n",
      "[555 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 8.32521e+10\tvalid_0's mse_score: 8.32521e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.21855e+11\tvalid_0's mse_score: 1.21855e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.20935e+11\tvalid_0's mse_score: 1.20935e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.45404e+11\tvalid_0's mse_score: 1.45404e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.1603e+11\tvalid_0's mse_score: 1.1603e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.84833e+11\tvalid_0's mse_score: 1.84833e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 8.87349e+10\tvalid_0's mse_score: 8.87349e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.21209e+11\tvalid_0's mse_score: 1.21209e+11\n",
      "Training until validation scores don't improve for 100 rounds\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 48%|████▊     | 10/21 [20:21<09:32, 52.07s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[100]\tvalid_0's l2: 1.0557e+11\tvalid_0's mse_score: 1.0557e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.5167e+11\tvalid_0's mse_score: 1.5167e+11\n",
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AB470160617552          28.0  1.783697e+07  2064228.0\n",
      "1    AB614679152621          29.0  1.356119e+07  1593304.0\n",
      "2    AC357556396608          32.0  1.367863e+07  1683736.0\n",
      "3    AC449966542855          27.0  1.380705e+07  1689134.0\n",
      "4    AC872462954823          33.0  1.367898e+07  1484596.0\n",
      "..              ...           ...           ...        ...\n",
      "915  ZY294539775651          34.0  1.371410e+07  1671978.0\n",
      "916  ZY567315914570          31.0  1.378900e+07  1644121.0\n",
      "917  ZZ233055353548          26.0  1.361717e+07  1669473.0\n",
      "918  ZZ450337373974           0.0  1.367336e+07  1548629.0\n",
      "919  ZZ544173652326           0.0  1.363191e+07  1548629.0\n",
      "\n",
      "[920 rows x 4 columns]\n",
      "CNYTN-MTMLA (920,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AB470160617552        49.899233         -1.153241         35  2064228.0\n",
      "1    AB614679152621         2.273758        102.547625         36  1593304.0\n",
      "2    AC357556396608        22.241708         40.718241         37  1683736.0\n",
      "3    AC449966542855        22.354793         43.484816         36  1689134.0\n",
      "4    AC872462954823        53.799287         12.541833         40  1484596.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "915  ZY294539775651        21.890467         38.297383         38  1671978.0\n",
      "916  ZY567315914570        35.994792         14.462784         39  1644121.0\n",
      "917  ZZ233055353548        29.752500         32.572748         40  1669473.0\n",
      "918  ZZ450337373974        16.635420        102.006067         38  1548629.0\n",
      "919  ZZ544173652326        16.537433        102.019308         37  1548629.0\n",
      "\n",
      "[920 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.66725e+10\tvalid_0's mse_score: 5.66725e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 6.98793e+10\tvalid_0's mse_score: 6.98793e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 4.17314e+10\tvalid_0's mse_score: 4.17314e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 5.31214e+10\tvalid_0's mse_score: 5.31214e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.06888e+11\tvalid_0's mse_score: 1.06888e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.19017e+11\tvalid_0's mse_score: 1.19017e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.88399e+10\tvalid_0's mse_score: 5.88399e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 6.53475e+10\tvalid_0's mse_score: 6.53475e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 4.48419e+10\tvalid_0's mse_score: 4.48419e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 5.42211e+10\tvalid_0's mse_score: 5.42211e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 52%|█████▏    | 11/21 [21:11<08:35, 51.59s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "        loadingOrder  speed_median     total_dis     label\n",
      "0     AA236935066990          24.0  2.685929e+06  374428.0\n",
      "1     AA597788695392          33.0  2.691566e+06  288172.0\n",
      "2     AA642567891255          23.0  2.684912e+06  326548.0\n",
      "3     AA681773043065          29.0  2.720285e+06  321478.0\n",
      "4     AB232279245750          22.5  2.687860e+06  273464.0\n",
      "...              ...           ...           ...       ...\n",
      "9342  ZZ880516271852          24.5  2.698045e+06  332141.0\n",
      "9343  ZZ907366774129          29.0  2.720285e+06  321478.0\n",
      "9344  ZZ936085205111          27.0  2.700691e+06  329922.0\n",
      "9345  ZZ964257538884          18.0  2.713565e+06  434727.0\n",
      "9346  ZZ992682575994          30.0  2.711504e+06  301117.0\n",
      "\n",
      "[9347 rows x 4 columns]\n",
      "CNYTN-MYTPP (9347,)\n",
      "        loadingOrder  latitude_median  longitude_median  speed_max     label\n",
      "0     AA236935066990        36.130617          7.623525         38  374428.0\n",
      "1     AA597788695392         3.443752        101.261245         36  288172.0\n",
      "2     AA642567891255         3.357050        101.956049         34  326548.0\n",
      "3     AA681773043065         2.590733        104.161091         32  321478.0\n",
      "4     AB232279245750        35.971917         14.891521         42  273464.0\n",
      "...              ...              ...               ...        ...       ...\n",
      "9342  ZZ880516271852        40.758550         41.446083         35  332141.0\n",
      "9343  ZZ907366774129         2.588883        104.165075         32  321478.0\n",
      "9344  ZZ936085205111         2.100575        103.926508         31  329922.0\n",
      "9345  ZZ964257538884       -20.140887         57.491727         35  434727.0\n",
      "9346  ZZ992682575994         2.644458        102.035500         32  301117.0\n",
      "\n",
      "[9347 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.84624e+10\tvalid_0's mse_score: 2.84624e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.19323e+10\tvalid_0's mse_score: 3.19323e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.37348e+10\tvalid_0's mse_score: 1.37348e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.64633e+10\tvalid_0's mse_score: 1.64633e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.79983e+10\tvalid_0's mse_score: 1.79983e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.07094e+10\tvalid_0's mse_score: 2.07094e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.54563e+10\tvalid_0's mse_score: 1.54563e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.87682e+10\tvalid_0's mse_score: 1.87682e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.82447e+10\tvalid_0's mse_score: 2.82447e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.14468e+10\tvalid_0's mse_score: 3.14468e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 57%|█████▋    | 12/21 [34:31<41:25, 276.20s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "        loadingOrder  speed_median     total_dis      label\n",
      "0     AA236935066990          25.0  3.048303e+06  1064428.0\n",
      "1     AA597788695392          33.0  3.023549e+06   323290.0\n",
      "2     AA642567891255          16.0  3.043121e+06   480400.0\n",
      "3     AA681773043065          28.0  3.052245e+06   366307.0\n",
      "4     AB283635056094          30.0  3.050662e+06   351123.0\n",
      "...              ...           ...           ...        ...\n",
      "6640  ZZ936085205111          28.0  3.036652e+06   374287.0\n",
      "6641  ZZ958783621355          23.0  3.016586e+06   408057.0\n",
      "6642  ZZ964257538884          17.0  3.085270e+06   555704.0\n",
      "6643  ZZ968915097734          21.0  2.998053e+06   884824.0\n",
      "6644  ZZ992682575994          15.0  3.043906e+06   381616.0\n",
      "\n",
      "[6645 rows x 4 columns]\n",
      "CNSHK-MYPKG (6645,)\n",
      "        loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0     AA236935066990        36.130617          7.623525         38  1064428.0\n",
      "1     AA597788695392         3.443752        101.261245         36   323290.0\n",
      "2     AA642567891255         3.357050        101.956049         34   480400.0\n",
      "3     AA681773043065         2.590733        104.161091         32   366307.0\n",
      "4     AB283635056094        19.641250        112.848083         33   351123.0\n",
      "...              ...              ...               ...        ...        ...\n",
      "6640  ZZ936085205111         2.100575        103.926508         31   374287.0\n",
      "6641  ZZ958783621355         5.923407        100.733506         35   408057.0\n",
      "6642  ZZ964257538884       -20.140887         57.491727         35   555704.0\n",
      "6643  ZZ968915097734        19.378290         98.848734         35   884824.0\n",
      "6644  ZZ992682575994         2.644458        102.035500         32   381616.0\n",
      "\n",
      "[6645 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.66093e+10\tvalid_0's mse_score: 2.66093e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.14668e+10\tvalid_0's mse_score: 3.14668e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 4.04694e+10\tvalid_0's mse_score: 4.04694e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 4.50002e+10\tvalid_0's mse_score: 4.50002e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 4.49407e+10\tvalid_0's mse_score: 4.49407e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 4.97846e+10\tvalid_0's mse_score: 4.97846e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.31495e+10\tvalid_0's mse_score: 3.31495e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.89417e+10\tvalid_0's mse_score: 3.89417e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.77759e+10\tvalid_0's mse_score: 2.77759e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.32189e+10\tvalid_0's mse_score: 3.32189e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 62%|██████▏   | 13/21 [40:13<39:26, 295.85s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AC973431878181          33.0  1.094381e+07  1233780.0\n",
      "1    AL455172449176          32.0  1.091632e+07  1279323.0\n",
      "2    AM630773305515          32.0  1.091632e+07  1279323.0\n",
      "3    AY143679328090          32.5  1.099063e+07  1213693.0\n",
      "4    BF148288797241          34.0  1.087544e+07  1254068.0\n",
      "..              ...           ...           ...        ...\n",
      "173  YY850490269067          32.5  1.093447e+07  1383308.0\n",
      "174  ZB861358603487          35.0  1.088456e+07  1267935.0\n",
      "175  ZD215105078416          18.0  1.086403e+07  1259959.0\n",
      "176  ZF166170112101          36.0  1.093270e+07  1181565.0\n",
      "177  ZH603370675025          33.0  1.089017e+07  1238274.0\n",
      "\n",
      "[178 rows x 4 columns]\n",
      "CNYTN-CAVAN (178,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AC973431878181        48.275583       -123.115356         40  1233780.0\n",
      "1    AL455172449176        41.603258        120.307400         39  1279323.0\n",
      "2    AM630773305515        41.240684        120.307333         40  1279323.0\n",
      "3    AY143679328090        34.487283        120.711742         50  1213693.0\n",
      "4    BF148288797241        48.643659       -123.097009         41  1254068.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "173  YY850490269067        41.263033        120.309575         39  1383308.0\n",
      "174  ZB861358603487        41.714833        138.681541         42  1267935.0\n",
      "175  ZD215105078416        48.476342       -125.225833         40  1259959.0\n",
      "176  ZF166170112101        48.493367        114.294775         42  1181565.0\n",
      "177  ZH603370675025        41.580908        120.065125         39  1238274.0\n",
      "\n",
      "[178 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.71535e+10\tvalid_0's mse_score: 1.71535e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.14453e+10\tvalid_0's mse_score: 2.14453e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.15566e+10\tvalid_0's mse_score: 2.15566e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.50993e+10\tvalid_0's mse_score: 2.50993e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.73542e+10\tvalid_0's mse_score: 3.73542e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 4.11812e+10\tvalid_0's mse_score: 4.11812e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.25019e+10\tvalid_0's mse_score: 3.25019e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.4589e+10\tvalid_0's mse_score: 3.4589e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.9325e+10\tvalid_0's mse_score: 1.9325e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.37483e+10\tvalid_0's mse_score: 2.37483e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 67%|██████▋   | 14/21 [40:24<24:33, 210.45s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "      loadingOrder  speed_median     total_dis      label\n",
      "0   AQ889642404042          30.0  2.103368e+07  3429375.0\n",
      "1   AU510504184664          24.0  2.053907e+07  3245323.0\n",
      "2   BQ425517215925          26.5  2.144451e+07  2836588.0\n",
      "3   BT552005629187          22.0  2.137377e+07  3892423.0\n",
      "4   BX633511112869          30.0  2.103418e+07  3429375.0\n",
      "..             ...           ...           ...        ...\n",
      "78  YY314907990848          29.0  2.094252e+07  3106668.0\n",
      "79  ZB984347982509          25.5  2.128172e+07  3153361.0\n",
      "80  ZK570930733133          18.0  2.140380e+07  3035341.0\n",
      "81  ZL336113063705          15.0  2.068156e+07  3180989.0\n",
      "82  ZS104404854005          29.0  2.133164e+07  3265670.0\n",
      "\n",
      "[83 rows x 4 columns]\n",
      "CNHKG-ARBUE (83,)\n",
      "      loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0   AQ889642404042       -24.520077         17.853480         40  3429375.0\n",
      "1   AU510504184664       -28.561865        -46.321355         39  3245323.0\n",
      "2   BQ425517215925       -24.754601        -14.708111         39  2836588.0\n",
      "3   BT552005629187       -27.944890         12.378376        189  3892423.0\n",
      "4   BX633511112869       -24.520077         17.851773         40  3429375.0\n",
      "..             ...              ...               ...        ...        ...\n",
      "78  YY314907990848       -26.739767         43.448067         39  3106668.0\n",
      "79  ZB984347982509       -25.499967        -43.669225         37  3153361.0\n",
      "80  ZK570930733133       -24.053099         18.070710         39  3035341.0\n",
      "81  ZL336113063705         1.272320        103.904088         33  3180989.0\n",
      "82  ZS104404854005         1.211920        100.921000         35  3265670.0\n",
      "\n",
      "[83 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.03905e+13\tvalid_0's mse_score: 1.03905e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.03905e+13\tvalid_0's mse_score: 1.03905e+13\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.01029e+13\tvalid_0's mse_score: 1.01029e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.01029e+13\tvalid_0's mse_score: 1.01029e+13\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 9.72137e+12\tvalid_0's mse_score: 9.72137e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 9.72137e+12\tvalid_0's mse_score: 9.72137e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.05628e+13\tvalid_0's mse_score: 1.05628e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.05628e+13\tvalid_0's mse_score: 1.05628e+13\n",
      "Training until validation scores don't improve for 100 rounds\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 71%|███████▏  | 15/21 [40:38<15:08, 151.49s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[100]\tvalid_0's l2: 1.11724e+13\tvalid_0's mse_score: 1.11724e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.11724e+13\tvalid_0's mse_score: 1.11724e+13\n",
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AI556878934887          25.0  1.785755e+07  2662752.0\n",
      "1    BH268733506477          26.0  1.793127e+07  2733730.0\n",
      "2    BM492258958969          24.0  1.797361e+07  2712305.0\n",
      "3    BV204161420507          25.0  1.803788e+07  2669928.0\n",
      "4    BV408123099936          28.0  1.807284e+07  2874957.0\n",
      "..              ...           ...           ...        ...\n",
      "104  ZJ419915508236          24.0  1.770251e+07  2706137.0\n",
      "105  ZK502690532194          26.0  1.684251e+07  2886862.0\n",
      "106  ZN247404591619          26.0  1.802913e+07  3054783.0\n",
      "107  ZV464815872671          24.0  1.802975e+07  2943940.0\n",
      "108  ZY198608121827          18.0  1.789850e+07  2867100.0\n",
      "\n",
      "[109 rows x 4 columns]\n",
      "CNNSA-GHTEM (109,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AI556878934887         1.209855         53.510801         31  2662752.0\n",
      "1    BH268733506477         1.343541         51.633320         30  2733730.0\n",
      "2    BM492258958969        -1.052736         18.433903         34  2712305.0\n",
      "3    BV204161420507        -7.128753         54.335957         30  2669928.0\n",
      "4    BV408123099936       -14.324496         32.718592         32  2874957.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "104  ZJ419915508236         1.205751         63.479962         34  2706137.0\n",
      "105  ZK502690532194       -10.408148         10.459539         32  2886862.0\n",
      "106  ZN247404591619       -14.259334         39.333717         31  3054783.0\n",
      "107  ZV464815872671         2.158187         30.262933         31  2943940.0\n",
      "108  ZY198608121827         1.274433        103.414592         32  2867100.0\n",
      "\n",
      "[109 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.32495e+11\tvalid_0's mse_score: 2.32495e+11\n",
      "Early stopping, best iteration is:\n",
      "[5]\tvalid_0's l2: 2.43975e+11\tvalid_0's mse_score: 2.43975e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.82771e+11\tvalid_0's mse_score: 1.82771e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.57265e+11\tvalid_0's mse_score: 1.57265e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.9128e+11\tvalid_0's mse_score: 2.9128e+11\n",
      "Early stopping, best iteration is:\n",
      "[12]\tvalid_0's l2: 2.96078e+11\tvalid_0's mse_score: 2.96078e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.9479e+11\tvalid_0's mse_score: 1.9479e+11\n",
      "Early stopping, best iteration is:\n",
      "[6]\tvalid_0's l2: 1.91661e+11\tvalid_0's mse_score: 1.91661e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.39571e+11\tvalid_0's mse_score: 2.39571e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.30554e+11\tvalid_0's mse_score: 2.30554e+11\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 76%|███████▌  | 16/21 [40:57<09:18, 111.72s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AC971525935172          30.0  1.421566e+07  2074432.0\n",
      "1    AE696573138143          27.0  1.432030e+07  2066705.0\n",
      "2    AI365973571487          28.0  1.439494e+07  2180772.0\n",
      "3    AJ183726554428          22.0  1.427273e+07  2457480.0\n",
      "4    AM102991728889          24.0  1.452708e+07  2191788.0\n",
      "..              ...           ...           ...        ...\n",
      "200  ZK351687238829          30.0  1.432640e+07  2062990.0\n",
      "201  ZS589584162034          21.5  1.431313e+07  2099506.0\n",
      "202  ZU401862054668          30.0  1.421566e+07  2074432.0\n",
      "203  ZU788257416574          25.0  1.433480e+07  2144583.0\n",
      "204  ZY357155860431          27.0  1.437756e+07  2073935.0\n",
      "\n",
      "[205 rows x 4 columns]\n",
      "CNNSA-NAWVB (205,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AC971525935172         2.418781          7.907092         34  2074432.0\n",
      "1    AE696573138143         1.332073         14.489393         34  2066705.0\n",
      "2    AI365973571487        -2.017388         46.356027         34  2180772.0\n",
      "3    AJ183726554428         2.734603          9.770095         33  2457480.0\n",
      "4    AM102991728889        -3.917366         25.670158         30  2191788.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "200  ZK351687238829       -11.590040         72.337306         33  2062990.0\n",
      "201  ZS589584162034         1.483345         14.371797         32  2099506.0\n",
      "202  ZU401862054668         2.418781          7.907092         34  2074432.0\n",
      "203  ZU788257416574         1.189536        103.550760         31  2144583.0\n",
      "204  ZY357155860431        -8.135530         75.614188         32  2073935.0\n",
      "\n",
      "[205 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.27666e+11\tvalid_0's mse_score: 1.27666e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.51254e+11\tvalid_0's mse_score: 1.51254e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.47403e+11\tvalid_0's mse_score: 1.47403e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.56917e+11\tvalid_0's mse_score: 1.56917e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.59448e+11\tvalid_0's mse_score: 2.59448e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.61888e+11\tvalid_0's mse_score: 2.61888e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.72147e+11\tvalid_0's mse_score: 1.72147e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.00209e+11\tvalid_0's mse_score: 2.00209e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.61153e+11\tvalid_0's mse_score: 1.61153e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.66064e+11\tvalid_0's mse_score: 1.66064e+11\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 81%|████████  | 17/21 [41:19<05:39, 84.87s/it] "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "      loadingOrder  speed_median     total_dis      label\n",
      "0   AO393647206772          29.0  1.509231e+07  2616736.0\n",
      "1   BS141811220707          15.5  1.543088e+07  2395084.0\n",
      "2   BT719395802096          32.5  1.438635e+07  2132292.0\n",
      "3   BY440962771393          27.0  1.372644e+07  1911958.0\n",
      "4   BZ623190611735           7.5  1.560521e+07  2238686.0\n",
      "..             ...           ...           ...        ...\n",
      "75  YT360665182781          22.0  1.458550e+07  2409520.0\n",
      "76  ZB421092044630          28.5  1.635456e+07  2597349.0\n",
      "77  ZE646628437331          11.0  1.558287e+07  2201389.0\n",
      "78  ZI166705356011          25.0  1.572325e+07  2510068.0\n",
      "79  ZM490479048723          28.5  1.531528e+07  2575134.0\n",
      "\n",
      "[80 rows x 4 columns]\n",
      "HKHKG-FRFOS (80,)\n",
      "      loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0   AO393647206772        22.287395         40.760166         35  2616736.0\n",
      "1   BS141811220707        39.398636         12.975829         41  2395084.0\n",
      "2   BT719395802096        36.244785         14.340832         39  2132292.0\n",
      "3   BY440962771393        39.445417          4.843903         37  1911958.0\n",
      "4   BZ623190611735        35.821058         14.534900         38  2238686.0\n",
      "..             ...              ...               ...        ...        ...\n",
      "75  YT360665182781        37.953978         23.588209         42  2409520.0\n",
      "76  ZB421092044630        30.557108         33.899383         39  2597349.0\n",
      "77  ZE646628437331        35.821091         14.539473         38  2201389.0\n",
      "78  ZI166705356011        21.861670         54.582411         37  2510068.0\n",
      "79  ZM490479048723        22.217863         99.908646         37  2575134.0\n",
      "\n",
      "[80 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 6.69522e+12\tvalid_0's mse_score: 6.69522e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 6.69522e+12\tvalid_0's mse_score: 6.69522e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 6.41677e+12\tvalid_0's mse_score: 6.41677e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 6.41677e+12\tvalid_0's mse_score: 6.41677e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.26381e+12\tvalid_0's mse_score: 5.26381e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 5.26381e+12\tvalid_0's mse_score: 5.26381e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 5.68889e+12\tvalid_0's mse_score: 5.68889e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 5.68889e+12\tvalid_0's mse_score: 5.68889e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 6.32459e+12\tvalid_0's mse_score: 6.32459e+12"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 86%|████████▌ | 18/21 [41:29<03:06, 62.24s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 6.32459e+12\tvalid_0's mse_score: 6.32459e+12\n",
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AC805998752079          28.0  7.826115e+06  1088790.0\n",
      "1    AE338443959265          14.5  7.772251e+06  1090489.0\n",
      "2    AF269374337927          31.0  7.774423e+06  1020228.0\n",
      "3    AO368338891545          19.0  7.857523e+06  1439257.0\n",
      "4    AV996737351035           0.0  7.740607e+06   923455.0\n",
      "..              ...           ...           ...        ...\n",
      "231  ZJ992630155921          27.0  7.698865e+06  1053212.0\n",
      "232  ZV202516667720          31.0  7.775146e+06  1019866.0\n",
      "233  ZY478921403623          31.0  7.774423e+06  1020228.0\n",
      "234  ZZ786612239899          19.0  7.812236e+06  1150478.0\n",
      "235  ZZ968915097734          21.5  7.750055e+06  1493900.0\n",
      "\n",
      "[236 rows x 4 columns]\n",
      "CNSHK-INMUN (236,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AC805998752079         2.927750        101.287167         32  1088790.0\n",
      "1    AE338443959265         6.393713         91.469181         36  1090489.0\n",
      "2    AF269374337927         9.357775         76.136267         33  1020228.0\n",
      "3    AO368338891545        22.433558         70.140146         31  1439257.0\n",
      "4    AV996737351035         2.432125        103.469683         36   923455.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "231  ZJ992630155921         2.780896        103.555908         37  1053212.0\n",
      "232  ZV202516667720         9.313116         76.125225         33  1019866.0\n",
      "233  ZY478921403623         9.357775         76.136267         33  1020228.0\n",
      "234  ZZ786612239899         2.766435        101.288041         38  1150478.0\n",
      "235  ZZ968915097734        19.378290         98.848734         35  1493900.0\n",
      "\n",
      "[236 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.52688e+10\tvalid_0's mse_score: 1.52688e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.81784e+10\tvalid_0's mse_score: 1.81784e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.65598e+10\tvalid_0's mse_score: 1.65598e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.07766e+10\tvalid_0's mse_score: 2.07766e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.71532e+10\tvalid_0's mse_score: 2.71532e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 3.04191e+10\tvalid_0's mse_score: 3.04191e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 8.58608e+09\tvalid_0's mse_score: 8.58608e+09\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 9.89295e+09\tvalid_0's mse_score: 9.89295e+09\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.38337e+10\tvalid_0's mse_score: 1.38337e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.73969e+10\tvalid_0's mse_score: 1.73969e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 90%|█████████ | 19/21 [41:38<01:32, 46.25s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=================================\n",
      "      loadingOrder  speed_median     total_dis      label\n",
      "0   AQ889642404042          30.0  2.104489e+07  3431548.0\n",
      "1   AU510504184664          24.0  2.057461e+07  3247761.0\n",
      "2   BQ425517215925          27.0  2.141703e+07  2839037.0\n",
      "3   BT552005629187          22.0  2.127967e+07  3889727.0\n",
      "4   BX633511112869          30.0  2.104522e+07  3431548.0\n",
      "..             ...           ...           ...        ...\n",
      "77  YY314907990848          29.0  2.095753e+07  3109057.0\n",
      "78  ZB984347982509          24.5  2.129936e+07  3155870.0\n",
      "79  ZK570930733133          20.0  2.158596e+07  3037870.0\n",
      "80  ZL336113063705          15.0  2.070638e+07  3183688.0\n",
      "81  ZS104404854005          29.0  2.135118e+07  3268311.0\n",
      "\n",
      "[82 rows x 4 columns]\n",
      "HONGKONG-BU (82,)\n",
      "      loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0   AQ889642404042       -24.520077         17.853480         40  3431548.0\n",
      "1   AU510504184664       -28.561865        -46.321355         39  3247761.0\n",
      "2   BQ425517215925       -24.754601        -14.708111         39  2839037.0\n",
      "3   BT552005629187       -27.944890         12.378376        189  3889727.0\n",
      "4   BX633511112869       -24.520077         17.851773         40  3431548.0\n",
      "..             ...              ...               ...        ...        ...\n",
      "77  YY314907990848       -26.739767         43.448067         39  3109057.0\n",
      "78  ZB984347982509       -25.499967        -43.669225         37  3155870.0\n",
      "79  ZK570930733133       -24.053099         18.070710         39  3037870.0\n",
      "80  ZL336113063705         1.272320        103.904088         33  3183688.0\n",
      "81  ZS104404854005         1.211920        100.921000         35  3268311.0\n",
      "\n",
      "[82 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 9.84861e+12\tvalid_0's mse_score: 9.84861e+12\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 9.84861e+12\tvalid_0's mse_score: 9.84861e+12\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.01484e+13\tvalid_0's mse_score: 1.01484e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.01484e+13\tvalid_0's mse_score: 1.01484e+13\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.02669e+13\tvalid_0's mse_score: 1.02669e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.02669e+13\tvalid_0's mse_score: 1.02669e+13\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.03872e+13\tvalid_0's mse_score: 1.03872e+13\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.03872e+13\tvalid_0's mse_score: 1.03872e+13\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.09482e+13\tvalid_0's mse_score: 1.09482e+13"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 95%|█████████▌| 20/21 [41:48<00:35, 35.60s/it]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.09482e+13\tvalid_0's mse_score: 1.09482e+13\n",
      "=================================\n",
      "       loadingOrder  speed_median     total_dis      label\n",
      "0    AA597788695392          32.0  9.153124e+06  1256949.0\n",
      "1    AA642567891255          21.0  9.114304e+06  1200145.0\n",
      "2    AC301230043784          29.0  9.121916e+06  1136634.0\n",
      "3    AD733551674501          29.0  9.121916e+06  1136634.0\n",
      "4    AI338314636212          29.5  9.078720e+06  1152492.0\n",
      "..              ...           ...           ...        ...\n",
      "941  ZY466646686415          22.0  9.225040e+06  1303323.0\n",
      "942  ZY717447456408          24.0  9.114551e+06  1136350.0\n",
      "943  ZY724149239691          29.0  9.021306e+06  1088948.0\n",
      "944  ZZ270424324968          29.5  9.188068e+06  1150454.0\n",
      "945  ZZ958783621355          30.0  9.118204e+06  1113821.0\n",
      "\n",
      "[946 rows x 4 columns]\n",
      "CNSHK-SGSIN-AEJEA (946,)\n",
      "       loadingOrder  latitude_median  longitude_median  speed_max      label\n",
      "0    AA597788695392         3.443752        101.261245         36  1256949.0\n",
      "1    AA642567891255         3.357050        101.956049         34  1200145.0\n",
      "2    AC301230043784        17.531253         79.833366         35  1136634.0\n",
      "3    AD733551674501        17.531253         79.833366         35  1136634.0\n",
      "4    AI338314636212        19.461502        103.792978         35  1152492.0\n",
      "..              ...              ...               ...        ...        ...\n",
      "941  ZY466646686415        24.509177         56.844398         35  1303323.0\n",
      "942  ZY717447456408        25.218421         55.057760         36  1136350.0\n",
      "943  ZY724149239691         2.818566        101.108090         39  1088948.0\n",
      "944  ZZ270424324968        24.527666         57.775750         36  1150454.0\n",
      "945  ZZ958783621355         5.923407        100.733506         35  1113821.0\n",
      "\n",
      "[946 rows x 5 columns]\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 6.36892e+10\tvalid_0's mse_score: 6.36892e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 6.56872e+10\tvalid_0's mse_score: 6.56872e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 3.70309e+10\tvalid_0's mse_score: 3.70309e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 4.13247e+10\tvalid_0's mse_score: 4.13247e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 1.07619e+11\tvalid_0's mse_score: 1.07619e+11\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 1.13092e+11\tvalid_0's mse_score: 1.13092e+11\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 2.5961e+10\tvalid_0's mse_score: 2.5961e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 2.76569e+10\tvalid_0's mse_score: 2.76569e+10\n",
      "Training until validation scores don't improve for 100 rounds\n",
      "[100]\tvalid_0's l2: 4.82134e+10\tvalid_0's mse_score: 4.82134e+10\n",
      "Early stopping, best iteration is:\n",
      "[1]\tvalid_0's l2: 5.26678e+10\tvalid_0's mse_score: 5.26678e+10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 21/21 [42:29<00:00, 121.39s/it]\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>loadingOrder</th>\n",
       "      <th>timestamp</th>\n",
       "      <th>longitude</th>\n",
       "      <th>latitude</th>\n",
       "      <th>carrierName</th>\n",
       "      <th>vesselMMSI</th>\n",
       "      <th>onboardDate</th>\n",
       "      <th>ETA</th>\n",
       "      <th>creatDate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>AE223035353902</td>\n",
       "      <td>2019-07-03T21:16:48.000Z</td>\n",
       "      <td>120.093858</td>\n",
       "      <td>22.581320</td>\n",
       "      <td>OIEQNT</td>\n",
       "      <td>C2075927370</td>\n",
       "      <td>2019-07-02 04:12:48</td>\n",
       "      <td>2019/07/26  13:59:24</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>AE223035353902</td>\n",
       "      <td>2019-07-03T21:34:48.000Z</td>\n",
       "      <td>120.035707</td>\n",
       "      <td>22.617522</td>\n",
       "      <td>OIEQNT</td>\n",
       "      <td>C2075927370</td>\n",
       "      <td>2019-07-02 04:12:48</td>\n",
       "      <td>2019/07/26  13:59:24</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>AE223035353902</td>\n",
       "      <td>2019-07-03T21:51:18.000Z</td>\n",
       "      <td>119.981800</td>\n",
       "      <td>22.658465</td>\n",
       "      <td>OIEQNT</td>\n",
       "      <td>C2075927370</td>\n",
       "      <td>2019-07-02 04:12:48</td>\n",
       "      <td>2019/07/26  13:59:24</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>AE223035353902</td>\n",
       "      <td>2019-07-03T21:54:18.000Z</td>\n",
       "      <td>119.970845</td>\n",
       "      <td>22.668688</td>\n",
       "      <td>OIEQNT</td>\n",
       "      <td>C2075927370</td>\n",
       "      <td>2019-07-02 04:12:48</td>\n",
       "      <td>2019/07/26  13:59:24</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>AE223035353902</td>\n",
       "      <td>2019-07-03T22:11:08.000Z</td>\n",
       "      <td>119.953628</td>\n",
       "      <td>22.756897</td>\n",
       "      <td>OIEQNT</td>\n",
       "      <td>C2075927370</td>\n",
       "      <td>2019-07-02 04:12:48</td>\n",
       "      <td>2019/07/26  13:59:24</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34707</th>\n",
       "      <td>ZZ524449869421</td>\n",
       "      <td>2020-03-17T04:02:38.000Z</td>\n",
       "      <td>103.776707</td>\n",
       "      <td>1.252897</td>\n",
       "      <td>BHSOUA</td>\n",
       "      <td>P2595193878</td>\n",
       "      <td>2020-03-13 06:07:28</td>\n",
       "      <td>2020/04/03  13:50:32</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34708</th>\n",
       "      <td>ZZ524449869421</td>\n",
       "      <td>2020-03-17T04:03:18.000Z</td>\n",
       "      <td>103.776312</td>\n",
       "      <td>1.253418</td>\n",
       "      <td>BHSOUA</td>\n",
       "      <td>P2595193878</td>\n",
       "      <td>2020-03-13 06:07:28</td>\n",
       "      <td>2020/04/03  13:50:32</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34709</th>\n",
       "      <td>ZZ524449869421</td>\n",
       "      <td>2020-03-17T04:05:18.000Z</td>\n",
       "      <td>103.775175</td>\n",
       "      <td>1.254865</td>\n",
       "      <td>BHSOUA</td>\n",
       "      <td>P2595193878</td>\n",
       "      <td>2020-03-13 06:07:28</td>\n",
       "      <td>2020/04/03  13:50:32</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34710</th>\n",
       "      <td>ZZ524449869421</td>\n",
       "      <td>2020-03-17T04:05:58.000Z</td>\n",
       "      <td>103.774803</td>\n",
       "      <td>1.255285</td>\n",
       "      <td>BHSOUA</td>\n",
       "      <td>P2595193878</td>\n",
       "      <td>2020-03-13 06:07:28</td>\n",
       "      <td>2020/04/03  13:50:32</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34711</th>\n",
       "      <td>ZZ524449869421</td>\n",
       "      <td>2020-03-17T04:07:38.000Z</td>\n",
       "      <td>103.773883</td>\n",
       "      <td>1.256368</td>\n",
       "      <td>BHSOUA</td>\n",
       "      <td>P2595193878</td>\n",
       "      <td>2020-03-13 06:07:28</td>\n",
       "      <td>2020/04/03  13:50:32</td>\n",
       "      <td>2020/06/29  13:43:26</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>34712 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         loadingOrder                 timestamp   longitude   latitude  \\\n",
       "0      AE223035353902  2019-07-03T21:16:48.000Z  120.093858  22.581320   \n",
       "1      AE223035353902  2019-07-03T21:34:48.000Z  120.035707  22.617522   \n",
       "2      AE223035353902  2019-07-03T21:51:18.000Z  119.981800  22.658465   \n",
       "3      AE223035353902  2019-07-03T21:54:18.000Z  119.970845  22.668688   \n",
       "4      AE223035353902  2019-07-03T22:11:08.000Z  119.953628  22.756897   \n",
       "...               ...                       ...         ...        ...   \n",
       "34707  ZZ524449869421  2020-03-17T04:02:38.000Z  103.776707   1.252897   \n",
       "34708  ZZ524449869421  2020-03-17T04:03:18.000Z  103.776312   1.253418   \n",
       "34709  ZZ524449869421  2020-03-17T04:05:18.000Z  103.775175   1.254865   \n",
       "34710  ZZ524449869421  2020-03-17T04:05:58.000Z  103.774803   1.255285   \n",
       "34711  ZZ524449869421  2020-03-17T04:07:38.000Z  103.773883   1.256368   \n",
       "\n",
       "      carrierName   vesselMMSI         onboardDate                   ETA  \\\n",
       "0          OIEQNT  C2075927370 2019-07-02 04:12:48  2019/07/26  13:59:24   \n",
       "1          OIEQNT  C2075927370 2019-07-02 04:12:48  2019/07/26  13:59:24   \n",
       "2          OIEQNT  C2075927370 2019-07-02 04:12:48  2019/07/26  13:59:24   \n",
       "3          OIEQNT  C2075927370 2019-07-02 04:12:48  2019/07/26  13:59:24   \n",
       "4          OIEQNT  C2075927370 2019-07-02 04:12:48  2019/07/26  13:59:24   \n",
       "...           ...          ...                 ...                   ...   \n",
       "34707      BHSOUA  P2595193878 2020-03-13 06:07:28  2020/04/03  13:50:32   \n",
       "34708      BHSOUA  P2595193878 2020-03-13 06:07:28  2020/04/03  13:50:32   \n",
       "34709      BHSOUA  P2595193878 2020-03-13 06:07:28  2020/04/03  13:50:32   \n",
       "34710      BHSOUA  P2595193878 2020-03-13 06:07:28  2020/04/03  13:50:32   \n",
       "34711      BHSOUA  P2595193878 2020-03-13 06:07:28  2020/04/03  13:50:32   \n",
       "\n",
       "                  creatDate  \n",
       "0      2020/06/29  13:43:26  \n",
       "1      2020/06/29  13:43:26  \n",
       "2      2020/06/29  13:43:26  \n",
       "3      2020/06/29  13:43:26  \n",
       "4      2020/06/29  13:43:26  \n",
       "...                     ...  \n",
       "34707  2020/06/29  13:43:26  \n",
       "34708  2020/06/29  13:43:26  \n",
       "34709  2020/06/29  13:43:26  \n",
       "34710  2020/06/29  13:43:26  \n",
       "34711  2020/06/29  13:43:26  \n",
       "\n",
       "[34712 rows x 9 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "for route in tqdm(test_order_belong_to_trace):\n",
    "    print('=================================')\n",
    "    route_order_info, route_order_handled = get_train_route_order_data(route)\n",
    "    print(route_order_handled)\n",
    "    train_data = get_train_data(route_order_info, route_order_handled)\n",
    "    print(train_data)\n",
    "    features = [c for c in train_data.columns if c not in ['loadingOrder', 'label']]\n",
    "    model_by_route = train_model(train_data[features], train_data['label'])\n",
    "    \n",
    "    for order in test_order_belong_to_trace[route]:\n",
    "        test_order_data = get_test_data(order)\n",
    "        res = model_by_route.predict(test_order_data[features], num_iteration=model_by_route.best_iteration)\n",
    "        test_data_origin.loc[test_data_origin['loadingOrder'] == order, 'ETA'] = (test_data_origin[test_data_origin['loadingOrder'] == order]['onboardDate'] + pd.Timedelta(seconds=res[0])).apply(lambda x:x.strftime('%Y/%m/%d  %H:%M:%S'))\n",
    "    \n",
    "test_data_origin['creatDate'] = pd.datetime.now().strftime('%Y/%m/%d  %H:%M:%S')\n",
    "test_data_origin['timestamp'] = test_data_origin['temp_timestamp']\n",
    "\n",
    "result = test_data_origin[['loadingOrder', 'timestamp', 'longitude', 'latitude', 'carrierName', 'vesselMMSI', 'onboardDate', 'ETA', 'creatDate']]\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "result.to_csv(result_path, index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.7.6 64-bit ('AI': conda)",
   "language": "python",
   "name": "python37664bitaiconda6859e03b37c34f0182c9bde8073269f7"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
